package list;

// 实现动态顺序表
public class Main {
    public static void main(String[] args) throws IndexIllegalException {
        MyArrayList myArrayList = new MyArrayList();
        myArrayList.add("zhangsan");
        myArrayList.add("lisi");
        myArrayList.add("wangwu");

        //1、捕捉add函数输入不合法
        try {
            myArrayList.add(5,"sb");
        }catch (IndexIllegalException e) {
            e.printStackTrace();
        }
        //2、捕捉get获取位置：顺序表为空、位置不合法
        try {
            myArrayList.get(5);
        }catch (EmptyArrayListException | IndexIllegalException e) {
            e.printStackTrace();
        }
    }
}